$OpenBSD: patch-Configure_pl,v 1.7 2017/03/07 21:21:20 pascal Exp $
--- Configure.pl.orig	Mon Feb 13 10:55:25 2017
+++ Configure.pl	Tue Mar  7 19:45:06 2017
@@ -72,10 +72,6 @@ if (-d '.git') {
     else { softfail("git error: $msg") }
 }
 
-# fiddle with flags
-$args{optimize}     = 3 if not defined $args{optimize} or $args{optimize} eq "";
-$args{debug}        = 3 if defined $args{debug} and $args{debug} eq "";
-
 for (qw(instrument static big-endian has-libtommath has-sha has-libuv
         has-libatomic_ops has-dynasm asan ubsan valgrind)) {
     $args{$_} = 0 unless defined $args{$_};
@@ -321,16 +317,13 @@ $config{ldlibs} = ' -lubsan ' . $config{ldlibs} if $ar
 # macro defs
 $config{ccdefflags} = join ' ', map { $config{ccdef} . $_ } @{$config{defs}};
 
-$config{ccoptiflags}  = sprintf $config{ccoptiflags},  defined_or $args{optimize}, 1 if $config{ccoptiflags}  =~ /%s/;
 $config{ccdebugflags} = sprintf $config{ccdebugflags}, defined_or $args{debug},    3 if $config{ccdebugflags} =~ /%s/;
-$config{ldoptiflags}  = sprintf $config{ldoptiflags},  defined_or $args{optimize}, 1 if $config{ldoptiflags}  =~ /%s/;
 $config{lddebugflags} = sprintf $config{lddebugflags}, defined_or $args{debug},    3 if $config{lddebugflags} =~ /%s/;
 
 
 # generate CFLAGS
 my @cflags;
 push @cflags, $config{ccmiscflags};
-push @cflags, $config{ccoptiflags}  if $args{optimize};
 push @cflags, $config{ccdebugflags} if $args{debug};
 push @cflags, $config{ccinstflags}  if $args{instrument};
 push @cflags, $config{ccwarnflags};
@@ -347,7 +340,6 @@ $config{cflags} = join ' ', @cflags;
 
 # generate LDFLAGS
 my @ldflags = ($config{ldmiscflags});
-push @ldflags, $config{ldoptiflags}  if $args{optimize};
 push @ldflags, $config{lddebugflags} if $args{debug};
 push @ldflags, $config{ldinstflags}       if $args{instrument};
 push @ldflags, $config{ldrpath}           unless $args{static};
@@ -358,6 +350,10 @@ $config{ldflags} = join ' ', @ldflags;
 # setup library names
 $config{moarlib} = sprintf $config{lib}, $NAME;
 $config{moardll} = sprintf $config{dll}, $NAME;
+
+if (exists $ENV{'SO_VERSION'}) {
+	$config{moardll} = $config{moardll} . "." . $ENV{'SO_VERSION'};
+}
 
 # setup flags for shared builds
 unless ($args{static}) {
